<script type="text/javascript">
var customprice = '{?$customprice?}';
function frmchapteredit_validate(){
  if(document.frmchapteredit.chaptername.value == ""){
    alert("请输入章节标题");
    document.frmchapteredit.chaptername.focus();
    return false;
  }
}
//统计输入字数
function show_inputwords(txt){
	txt = $_(txt);
	var words = (arguments.length > 1) ? $_(arguments[1]) : $_(txt.id + '_words');
	words.innerHTML = txt.value.replace(/[\x00-\x08\x0e-\x1f\x21-\xff]+/gi, 'w').replace(/\s/g, '').length;
}
//显示默认字数
addEvent(window, 'load', function(){show_inputwords('chaptercontent');});
</script>
<script type="text/javascript" src="{?$jieqi_url?}/scripts/attaches.js"></script>
<form name="frmchapteredit" id="frmchapteredit" action="{?$jieqi_modules['article']['url']?}/admin/draftedit.php?do=submit" method="post" onsubmit="return frmchapteredit_validate();" enctype="multipart/form-data">
<table width="100%" class="grid" cellspacing="1" align="center">
<caption>编辑草稿</caption>
<tr valign="middle" align="left">
		<td class="tdl" width="20%">{?if $isvip == 0?}小说名称：{?else?}电子书名称：{?/if?}</td>
		<td class="tdr">
		{?if $isvip == 0?}
		{?$articlename?} <input type='hidden' name='articleid' value='{?$articleid?}' />
		{?else?}
		{?$articlename?} <input type='hidden' name='obookid' value='{?$obookid?}' />
		{?/if?}
		</td>
</tr>
<tr valign="middle" align="left">
  <td class="tdl">章节标题：</td>
  <td class="tdr"><input type="text" class="text" name="chaptername" id="chaptername" size="50" maxlength="50" value="{?$chaptername?}" /></td>
</tr>
{?if $isvip > 0 && $customprice > 0?}
	<tr valign="middle" align="left" id="sprice">
		<td class="tdl">本章定价：</td>
		<td class="tdr"><input type='text' class='text' name='saleprice' id='saleprice' size='10' maxlength='10' value='{?$saleprice?}' /><span class="hot">{?$egoldname?}(留空则自动按字数计价)</span></td>
	</tr>
{?/if?}
<tr valign="middle" align="left">
		<td class="tdl">是否定时发表：</td>
		<td class="tdr">
		<label class="radio"><input type="radio" name="uptiming" value="0"{?if $pubdate == 0?} checked="checked"{?/if?} onclick="document.getElementById('pubtime').style.display='none';" />否</label> &nbsp; 
		<label class="radio"><input type="radio" name="uptiming" value="1"{?if $pubdate > 0?} checked="checked"{?/if?} onclick="document.getElementById('pubtime').style.display='';" />是</label> &nbsp; 
		</td>
</tr>
<tr valign="middle" align="left" id="pubtime" {?if $pubdate == 0?}style="display:none;"{?/if?}>
		<td class="tdl">定时发表时间：</td>
		<td class="tdr">
		<input type="text" class="text" name="pubyear" id="pubyear" size="4" maxlength="4" value="{?$pubyear?}" />年<input type="text" class="text" name="pubmonth" id="pubmonth" size="2" maxlength="2" value="{?$pubmonth?}" />月<input type="text" class="text" name="pubday" id="pubday" size="2" maxlength="2" value="{?$pubday?}" />日<input type="text" class="text" name="pubhour" id="pubhour" size="2" maxlength="2" value="{?$pubhour?}" />时<input type="text" class="text" name="pubminute" id="pubminute" size="2" maxlength="2" value="{?$pubminute?}" />分
		</td>
</tr>
<tr valign="middle" align="left">
  <td class="tdl">章节内容：<br />已输入 <span class="hot" id="chaptercontent_words">0</span> 字</td>
  <td class="tdr"><textarea class="textarea" name="chaptercontent" id="chaptercontent" style="width:100%;height:400px;" onkeyup="show_inputwords(this);" oninput="show_inputwords(this);" onpropertychange="show_inputwords(this);">{?$chaptercontent?}</textarea></td>
</tr>
{?if $attachnum > 0?}
<tr valign="middle" align="left">
  <td class="tdl">现有附件： <br /><span class="hot">（取消打勾表示删除该附件）</span></td>
  <td class="tdr">
  {?section name=i loop=$attachrows?}
  <input type="checkbox" name="oldattach[]" value="{?$attachrows[i].attachid?}" checked="checked" /><a href="{?$attachrows[i].url?}" target="_blank">{?$attachrows[i].name?}</a> 
  {?/section?}
  </td>
</tr>
{?/if?}
{?if $canupload == true && $maxattachnum > 0?}
<tr valign="middle" align="left">
  <td class="tdl">附件限制：</td>
  <td class="tdr">文件类型：{?$attachtype?}, 图片最大：{?$maximagesize?}K, 文件最大：{?$maxfilesize?}K</td>
</tr>
<tr valign="middle" align="left">
  <td class="tdl">附件上传：</td>
  <td class="tdr">
  <input type="file" class="file" name="attachfile[]" id="attachfile" onchange="Attaches.addFile('attachfile', 'attachdiv', true);" /><button type="button" class="filebutton" onclick="if(document.all){document.getElementById('attachfile').outerHTML += '';}else{document.getElementById('attachfile').value = '';}">清空</button>
  <div id="attachdiv"></div>
  </td>
</tr>
{?/if?}
<tr valign="middle" align="left">
  <td class="tdl">&nbsp;
  <input type="hidden" name="act" value="update" />{?$jieqi_token_input?}
  <input type="hidden" name="id" value="{?$id?}" />
  <input type="hidden" name="isvip" value="{?$isvip?}" />
  </td>
  <td class="tdr"><button type="submit" class="button" name="submit">提 交</button></td>
</tr>
</table>
</form>